﻿using System.Data.Entity.ModelConfiguration;
using SailHero.Soft.FrameWork.Models;

namespace SailHero.Soft.FrameWork.Mapping.ProductDB
{
    public class ProductInfoMap : EntityTypeConfiguration<ProductInfo>
    {
        public ProductInfoMap()
        {
            // Primary Key
            this.HasKey(t => t.ProductId);

            // Properties
            this.Property(t => t.ProductName)
                .IsRequired()
                .HasMaxLength(128);

            // Table & Column Mappings
            this.ToTable("ProductInfo");
            this.Property(t => t.ProductId).HasColumnName("ProductId");
            this.Property(t => t.ProductName).HasColumnName("ProductName");
            this.Property(t => t.Price).HasColumnName("Price");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
        }
    }
}

